JavaScript : Fundamentals by Brennien Coker & Story Ninjas

JavaScript : Fundamentals by Brennien Coker & Story Ninjas

Author:Brennien Coker & Story Ninjas [Coker, Brennien]
Language: eng
Format: azw3
Publisher: Story Ninjas
Published: 2017-08-21T04:00:00+00:00


Null

The Null data type is used to represent a value of nothing. There is only one null value, unlike the other data types.

When are you likely to work with a null value? Let’s say you wanted to create a function that would iterate through a collection of objects and return all the objects that are not equal to a specific object for example. Normally this function would return a collection that is a subset of the original list, but what would happen if the original collection only contained a bunch of that specific object. As the code iterated through the collection it would skip all of the items because they all match. There would be nothing to return. In that case, null would be returned.

It is important to note that JavaScript has a well know bug with regard to the Null data type. The typeof operator is used to determine what data type a variable is, however, it returns "object" as the type for null. This is unfortunate, as null is considered its own data type.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.